package com.lx.oms.controller.manager.impl;

import java.math.BigInteger;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.utils.Utils;
import com.lx.oms.controller.dao.WCategoryMapper;
import com.lx.oms.controller.entity.WCategoryEntity;
import com.lx.oms.controller.manager.WCategoryManager;

/**
 * 微信类别
 *
 * @author houzhong
 * @date 2018年8月06日 上午11:40:32
 */
@Component("wCategoryManager")
public class WCategoryManagerImpl implements WCategoryManager {

	@Autowired
	private WCategoryMapper wCategoryMapper;
	

	@Override
	public List<WCategoryEntity> listWCategory(Page<WCategoryEntity> page, Query search) {
		return wCategoryMapper.listForPage(page, search);
	}

	@Override
	public int saveWCategory(WCategoryEntity wCategory) {
		if (wCategory.getId() == null) {
			wCategory.setId(Utils.id().toString());
		}
		return wCategoryMapper.save(wCategory);
	}

	@Override
	public WCategoryEntity getWCategoryById(BigInteger id) {
		WCategoryEntity wCategory = wCategoryMapper.getObjectById(id);
		return wCategory;
	}

	@Override
	public int updateWCategory(WCategoryEntity wCategory) {
		return wCategoryMapper.update(wCategory);
	}

	@Override
	public int batchRemove(String[] id) {
		int count = wCategoryMapper.batchRemove(id);
		return count;
	}
	
}
